import 'package:baselib/utils/color_base_util.dart';
import 'package:baselib/utils/string_base_util.dart';
import 'package:flutter/material.dart';

// 选择的类型
enum SelectedType {
  CancelType,
  SelectedPhotoType,
  SelectedCameraType,
}
// ignore: must_be_immutable
class SelectPhotoOrCameraAlertWidget extends StatelessWidget {

  SelectedType _selectedType = SelectedType.SelectedPhotoType;

  @override
  Widget build(BuildContext context) {
    return Container(
      height: 161,
      child: Column(
        children: <Widget>[
          buildRow("${StringBaseUtil().Album}",context),
          // SizedBox(height: 1,),
          Container(
            height: 0.5,
            width: MediaQuery.of(context).size.width,
            decoration: BoxDecoration(
              color: ColorBaseUtil().color_half_transparent
            ),
            child: Text(''),
          ),
          buildRow("${StringBaseUtil().Camera}",context),
          Container(
            height: 5,
            width: MediaQuery.of(context).size.width,
            decoration: BoxDecoration(
                color: ColorBaseUtil().color_half_transparent
            ),
            child: Text(''),
          ),
          buildRow("${StringBaseUtil().Cancel}",context),
        ],
      ),
    );
  }

  Widget buildRow(String text,BuildContext context) {
    return InkWell(
      child: Container(
        // color: Colors.white,
        height: 50,
        alignment: Alignment.center,
        child: Text(text,style: TextStyle(
            color: Colors.white,
            fontSize: 14),),
      ),
      onTap: () {
        if(text == "${StringBaseUtil().Cancel}") {
          _selectedType = SelectedType.CancelType;

        }else if(text == "${StringBaseUtil().Camera}") {
          _selectedType = SelectedType.SelectedCameraType;

        }else {
          _selectedType = SelectedType.SelectedPhotoType;
        }
        Navigator.of(context).pop(_selectedType);
      },
    );
  }
}
